package collection.homework.List;

import java.util.ArrayList;
import java.util.List;

public class ListDemo3 {
    public static void main(String[] args) {
        List<Integer> list = new ArrayList<>();
        for (int i=0;i<10;i++){
            list.add(i*10);
        }
        System.out.println("list:"+list);//list:[0, 10, 20, 30, 40, 50, 60, 70, 80, 90]
        List<Integer> subList = list.subList(2,5);
        System.out.println("subList:"+subList);//subList:[20, 30, 40]

        for (int i=0;i<subList.size();i++){
            subList.set(i, subList.get(i)*10);
        }
        System.out.println("subList:"+subList);//subList:[200, 300, 400]
        System.out.println("list:"+list);//list:[0, 10, 200, 300, 400, 50, 60, 70, 80, 90]
        list.set(2,1000);
        System.out.println("list:"+list);//list:[0, 10, 1000, 300, 400, 50, 60, 70, 80, 90]
        System.out.println("subList:"+subList);//subList:[1000, 300, 400]

        list.remove(0);
        System.out.println("list:"+list);//list:[10, 1000, 300, 400, 50, 60, 70, 80, 90]
    }
}
